

const EDGE_SIZE = 80;
const LINE_SIZE = 100;
class Point {
  constructor (key, h1, h2, h3, v1, v2, v3, x, y) {
    this.id = key;
    this.horizontal = [h1, h2, h3];
    this.vertical = [v1, v2, v3];
    this.coordinates = {x, y};
    this.piece = 0;
    this.marker = true;
    this.location = {x: x * LINE_SIZE + EDGE_SIZE, y: y * LINE_SIZE + EDGE_SIZE};
  }

  //判断两个棋子是否相邻
  is_adjacent = function(another) {
    if (another === 0) {
      return false
    }
    for (let key of this.horizontal) {
      if (another === key) {
        return true
      }
    }
    for (let key of this.vertical) {
      if (another === key) {
        return true
      }
    }
    return false
  }
}

export { Point }
